from .expression import Expression


class Call(Expression):
    
    def __init__(self, func_name):
        
        self.__func_name = func_name
        self.__args = []
        
    def add_argument(self, expr):
        self.__args.append(expr)
        return self
        
    def eval(self, scope):
        func = scope.lookup(self.__func_name)
        arg_vals = [expr.eval(scope) for expr in self.__args]
        return func(*arg_vals)